﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyClock
{
     class Clock
    {
        public static bool ifAlarm = false;
        public static bool ifTick=true;
        //调用一次减一秒
        public static void tick(int[]times)
        {
            //判断是否响滴答声
            if (ifTick)
            {
                System.Media.SoundPlayer sp=new System.Media.SoundPlayer(Properties.Resources.tic);
             //   sp.Play();
            }

           
                if (times[2] > 0)
                {
                    times[2]--;
                }
                else if (times[1] > 0)
                {
                    times[1]--;
                    times[2] = 59;
                }
                else if (times[0] > 0)
                {
                    times[0]--;
                    times[1] = 59;
                    times[2] = 59;
                }
                else
                {
                    ifAlarm = true;
                }
            
          

        }

        public static void alarm() {
            System.Media.SoundPlayer sp = new System.Media.SoundPlayer(Properties.Resources.ala);
            sp.Play();
        }

       

        //改变是否响声音的状态
        public static void changeTick() {
            ifTick = !ifTick;
        }
      
    }
}
